import React,{useState} from "react";
import dynamic from 'next/dynamic'
import Head from "next/head";

const One = dynamic(import('../../component/one'))

//优化使用LazyLoading 懒加载
function Time(){
    const [newTime,setTime] = useState(Date.now())

    const changeTime=async ()=>{
        const moment = await import('moment')
        setTime(moment.default(Date.now()).format())
    }

    return (
        <>
            <Head>
                <title>我是最牛的人</title>
                <meta charset="utf-8"/>
            </Head>
            <h1>显示时间{newTime}</h1>
            <One/>
            <div><button onClick={changeTime}>改变时间</button></div>
        </>
    )
}

export default Time